<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: hiugiak
  Date: 2018-12-15
  Time: 20:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="cn.edu.hnu.gpg.service.DepartmentService" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>

<%
    WebApplicationContext wac =  WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
    DepartmentService departmentService = wac.getBean(DepartmentService.class);
%>

<c:forEach var="department" items="<%=departmentService.listDepartments()%>">
    <option value="${department.departmentId}">${department.name}</option>
</c:forEach>
